package com.ruoyi.web.controller.basic;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.BasicSiteTemplate;
import com.ruoyi.system.service.IBasicSiteTemplateService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 站点模型;Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/basicSiteTemplate")
public class BasicSiteTemplateController extends BaseController
{
    @Autowired
    private IBasicSiteTemplateService basicSiteTemplateService;

    /**
     * 查询站点模型;列表
     */
    @PreAuthorize("@ss.hasPermi('system:basicSiteTemplate:list')")
    @GetMapping("/list")
    public TableDataInfo list(BasicSiteTemplate basicSiteTemplate)
    {
        startPage();
        List<BasicSiteTemplate> list = basicSiteTemplateService.selectBasicSiteTemplateList(basicSiteTemplate);
        return getDataTable(list);
    }

    /**
     * 导出站点模型;列表
     */
    @PreAuthorize("@ss.hasPermi('system:basicSiteTemplate:export')")
    @Log(title = "站点模型;", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BasicSiteTemplate basicSiteTemplate)
    {
        List<BasicSiteTemplate> list = basicSiteTemplateService.selectBasicSiteTemplateList(basicSiteTemplate);
        ExcelUtil<BasicSiteTemplate> util = new ExcelUtil<BasicSiteTemplate>(BasicSiteTemplate.class);
        util.exportExcel(response, list, "站点模型;数据");
    }

    /**
     * 获取站点模型;详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:basicSiteTemplate:query')")
    @GetMapping(value = "/{siteTemplateId}")
    public AjaxResult getInfo(@PathVariable("siteTemplateId") Long siteTemplateId)
    {
        return success(basicSiteTemplateService.selectBasicSiteTemplateBySiteTemplateId(siteTemplateId));
    }

    /**
     * 新增站点模型;
     */
    @PreAuthorize("@ss.hasPermi('system:basicSiteTemplate:add')")
    @Log(title = "站点模型;", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BasicSiteTemplate basicSiteTemplate)
    {
        return toAjax(basicSiteTemplateService.insertBasicSiteTemplate(basicSiteTemplate));
    }

    /**
     * 修改站点模型;
     */
    @PreAuthorize("@ss.hasPermi('system:basicSiteTemplate:edit')")
    @Log(title = "站点模型;", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BasicSiteTemplate basicSiteTemplate)
    {
        return toAjax(basicSiteTemplateService.updateBasicSiteTemplate(basicSiteTemplate));
    }

    /**
     * 删除站点模型;
     */
    @PreAuthorize("@ss.hasPermi('system:basicSiteTemplate:remove')")
    @Log(title = "站点模型;", businessType = BusinessType.DELETE)
	@DeleteMapping("/{siteTemplateIds}")
    public AjaxResult remove(@PathVariable Long[] siteTemplateIds)
    {
        return toAjax(basicSiteTemplateService.deleteBasicSiteTemplateBySiteTemplateIds(siteTemplateIds));
    }
}
